<?php
namespace Home\Model;
use Think\Model;
class DeviceModel extends Model{ 
	public function get_device_list($condition = array(), $limit = 20, $page = 1, $field = "*", $order = "dev_id desc")
    {
        $data = $this->where($condition)->join("left join tb_version on dev_version_id = ve_id")->field($field)->limit($limit)->page($page)->order($order)->select();
        $device_config = C('device_status');
        foreach ($data as $key => $value) {
        	$data[$key]['dev_status_name'] = $device_config[$value['dev_status']];
        }
        return $data;
    }

    public function get_count($condition = array()){
        return $this->where($condition)->count();
    }
}
?>